# coding: utf-8

import sys
reload(sys)
sys.setdefaultencoding('utf-8')
'''
中华保险验证官方网址
http://query.cic.cn
0617130208140360000794
132526196902170527
'''

# from spider.renbao_spider import RenbaoSpider
# from spider.zhonghua_spider import ZhonghuaSpider
# from spider.taipingyang_spider import TaipingyangSpider
from spider import RenbaoSpider, ZhonghuaSpider, TaipingyangSpider

querys = [
    ('PDAA201751050000052153', '510521197904185863'),
    ('PDAA20183404DAM0002070', '340403196911240424'),
    ('PDAA20183404DAM0002004', '340403196510021618'),
    ('PDAA20183404DAM0002008', '340404196405302211'),
    ('PDAA20183424DAM0001116', '342422197206147799'),
    ('PDAA201834100000003219', '341004198402150417'),
    ('0618320622D00360000026','320624197311176012'),
    ('0618130213280360000165','130229198503034050'),
    ('0618130515100360000054','130522199608211216'),
    ('0618130214190360000065','130227199312102817'),
    ('0618130612160360000061','130682196306060668'),
    ('AZHZZ11Y1418B002910V','410782197807215418'),
    ('AZHZZ11Y1418B002912D','411323198202073035'),
    ('AWUH57ZY1418B000399C','42282319680918113X'),
    ('AHAZ993Y1418B000524L','332523197309101822')
]
query = querys[3]
renbao_spider = RenbaoSpider()
zhonghua_spider = ZhonghuaSpider()
taipingyang_spider = TaipingyangSpider()

def get_spider(policy_no):
    char = policy_no[0:1]
    dic = { 'P': renbao_spider, '0': zhonghua_spider, 'A': taipingyang_spider }
    # dic = {'P': None, '0': zhonghua_spider, 'A': None}
    return dic.get(char, None)

for query in querys:
    policy_no = query[0]
    idcard_no = query[1]
    spider = get_spider(policy_no)
    if spider is None:
        continue
    spider.run(policy_no, idcard_no)
